package com.xplay.xpocker.room.mahjong.constant;

import com.xplay.xpocker.constant.RoomTypeEnum;

import java.util.Arrays;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;

public enum PbTypeEnum {
    BUMP(1, "碰"), DARK_BAR(2, "暗杠"), MING_BAR(3, "明杠"), DIAN_BAR(4, "点杠");
    private Integer type;
    private String name;


    static {
        PB_CACHE = Arrays.stream(PbTypeEnum.values()).collect(Collectors.toMap(PbTypeEnum::getType, Function.identity()));
    }

    private static final Map<Integer, PbTypeEnum> PB_CACHE;

    public static PbTypeEnum ofType(Integer type) {
        return PB_CACHE.get(type);
    }

    PbTypeEnum(Integer type, String name) {
        this.type = type;
        this.name = name;
    }

    public Integer getType() {
        return type;
    }

    public void setType(Integer type) {
        this.type = type;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
}
